﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cmd.TypeConverters
{
    public class NullableInt16Converter : BaseTypeConverter<short?>
    {
        public override short? ConvertFromString(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return default(short?);
            }

            return short.Parse(value as string);

        }

        public override string ConvertToString(object value)
        {
            if (value == null)
            {
                return null;
            }
            return value.ToString();
        }
    }
}
